package com.homework_9;

public class Students {
    private String sname;
    private String sno;
    private int age;
    private String scollge;

    public Students(String sname, String sno, int age, String scollge) {
        this.sname = sname;
        this.sno = sno;
        this.age = age;
        this.scollge = scollge;
    }

    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    public String getSno() {
        return sno;
    }

    public void setSno(String sno) throws Exception {
       if (sno.length()>=8){
           this.sno = sno;
       }else{
            throw new IllegleSnoException("学号输入错误");
       }
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws Exception{
       if (age>0&&age<200){
           this.age = age;
       }else{
           throw new IllegleSageException("年龄不能为负数或大于200");
       }
    }

    public String getScollge() {
        return scollge;
    }

    public void setScollge(String scollge) {
        this.scollge = scollge;
    }

    public void printInfor(){
        System.out.println(getSname()+getSname()+getAge()+getScollge());
    }
}
